package Test.Practice;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @author handsomePot
 * @date 2022/1/2 23:50
 */
public class UnParkDemo {

    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(() -> {

            System.out.println("线程-1  被挂起");
            LockSupport.park();
            System.out.println("线程-1  被唤醒");

            System.out.println(Thread.currentThread().isInterrupted());

        });
        thread.start();

        TimeUnit.SECONDS.sleep(1);

        Thread thread1 = new Thread(() -> {
            System.out.println("准备中断线程-1");
            thread.interrupt();
            System.out.println("唤醒 中断线程-1 成功");
        });
        thread1.start();

        TimeUnit.SECONDS.sleep(Integer.MAX_VALUE);

    }

}
